diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index f374ee3..9d89d1e 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.15 +// @version 0.13.16 // @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.15'; +const VERSION = '0.13.16'; const CFG = { // — Battle automation @@ -488,10 +488,12 @@ function parseBattleState() { $$('img[onmouseover]', pane).forEach(img => { const omo = img.getAttribute('onmouseover') || ''; const dur = omo.match(/(\d+)\s*turns?\s*rem/); + // Also try to get turn count from the last parameter of set_infopane_effect + const rawDur = omo.match(/set_infopane_effect\([^,]+,\s*'[^']*',\s*(\d+)\s*\)/); // 'permanent' means the buff lasts indefinitely (Absorb, autocast effects) const isPermanent = omo.includes("'permanent'"); const name = (img.src || '').split('/').pop().replace('.png', ''); - const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : 50); + const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : (rawDur ? parseInt(rawDur[1]) : 50)); STATE.buffs[name] = turns; // Track the max duration seen for this buff (for fill-level calculation) if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) { diff --git a/scripts/latest.user.js b/scripts/latest.user.js index f374ee3..9d89d1e 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.15 +// @version 0.13.16 // @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.15'; +const VERSION = '0.13.16'; const CFG = { // — Battle automation @@ -488,10 +488,12 @@ function parseBattleState() { $$('img[onmouseover]', pane).forEach(img => { const omo = img.getAttribute('onmouseover') || ''; const dur = omo.match(/(\d+)\s*turns?\s*rem/); + // Also try to get turn count from the last parameter of set_infopane_effect + const rawDur = omo.match(/set_infopane_effect\([^,]+,\s*'[^']*',\s*(\d+)\s*\)/); // 'permanent' means the buff lasts indefinitely (Absorb, autocast effects) const isPermanent = omo.includes("'permanent'"); const name = (img.src || '').split('/').pop().replace('.png', ''); - const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : 50); + const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : (rawDur ? parseInt(rawDur[1]) : 50)); STATE.buffs[name] = turns; // Track the max duration seen for this buff (for fill-level calculation) if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) { diff --git a/src/battle-parser.js b/src/battle-parser.js index decbecb..e635136 100644 --- a/src/battle-parser.js +++ b/src/battle-parser.js @@ -146,10 +146,12 @@ function parseBattleState() { $$('img[onmouseover]', pane).forEach(img => { const omo = img.getAttribute('onmouseover') || ''; const dur = omo.match(/(\d+)\s*turns?\s*rem/); + // Also try to get turn count from the last parameter of set_infopane_effect + const rawDur = omo.match(/set_infopane_effect\([^,]+,\s*'[^']*',\s*(\d+)\s*\)/); // 'permanent' means the buff lasts indefinitely (Absorb, autocast effects) const isPermanent = omo.includes("'permanent'"); const name = (img.src || '').split('/').pop().replace('.png', ''); - const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : 50); + const turns = isPermanent ? 999 : (dur ? parseInt(dur[1]) : (rawDur ? parseInt(rawDur[1]) : 50)); STATE.buffs[name] = turns; // Track the max duration seen for this buff (for fill-level calculation) if (turns < 999 && turns > (STATE.maxBuffDur[name] || 0)) { diff --git a/src/config.js b/src/config.js index 9a98df4..dc586d9 100644 --- a/src/config.js +++ b/src/config.js @@ -2,7 +2,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.13.15'; +const VERSION = '0.13.16'; const CFG = { // — Battle automation diff --git a/src/header.user.js b/src/header.user.js index df83265..61f5e99 100644 --- a/src/header.user.js +++ b/src/header.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.13.15 +// @version 0.13.16 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/*