From 94ab29a82c295d565903579825289e72874efbc1 Mon Sep 17 00:00:00 2001 From: GaboGG Date: Mon, 27 Jul 2026 20:14:21 -0400 Subject: [PATCH] v0.14.18 - Spirit Stance burst toggle for 7+ mob Rending Blow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - When 7+ enemies and OC >= 60: toggles Spirit Stance ON before casting Rending Blow, then toggles OFF after one skill - Uses 3-state flag: press1=toggleON, press2=castSkill, press3=toggleOFF - Only triggers on normal (non-panic) Rending Blow — step 0e emergency skill still fires without spirit to avoid delay - Resets on battle init and when conditions change --- scripts/hv-unified.user.js | 36 +++++++++++++++++++++++++++++++----- scripts/latest.user.js | 36 +++++++++++++++++++++++++++++++----- src/config.js | 2 +- src/header.user.js | 2 +- src/init.js | 1 + src/state.js | 3 ++- src/strategy-engine.js | 28 ++++++++++++++++++++++++++-- 7 files changed, 93 insertions(+), 15 deletions(-) diff --git a/scripts/hv-unified.user.js b/scripts/hv-unified.user.js index 3adc933..08e6566 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.14.17 +// @version 0.14.18 // @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.14.17'; +const VERSION = '0.14.18'; const CFG = { // — Battle automation @@ -78,7 +78,8 @@ const STATE = { battleInitialized: false, _mysticUsed: false, // Track if Mystic Gem has been used this battle - _lastActionTime: 0, // Timestamp of last dispatched action (for Q debounce) + _lastActionTime: 0, + _spiritForSkill: 0, // 3-state flag for burst spirit toggle (0=off, 1=toggle-on, 2=cast-done) // Timestamp of last dispatched action (for Q debounce) _baseMpCosts: {}, // Cached base MP costs for buff spells (read from magic pane at battle start) @@ -1427,8 +1428,32 @@ function strategyVeteran() { if (STATE.spiritStance && STATE.sp < 0.60) { return { type: 'toggle_spirit', _reason: 'sp_safety' }; } - - // 0d. HIGH-THREAT WEAPON SKILLS — before buffs/items/debuffs + + // 0d. Spirit Stance for burst clear — toggle on for 7+ mob, off after one skill + // 3-state flag: 0=normal, 1=toggle-on sent, 2=skill-cast done (toggle-off pending) + const is2H = STATE.skillsKnown.includes('Great Cleave') || STATE.skillsKnown.includes('Rending Blow'); + if (is2H && STATE.monsters && STATE.monsters.length >= 7 && STATE.oc >= (CFG.skillOC || 60)) { + if (STATE._spiritForSkill >= 1 && STATE.spiritStance) { + // Spirit is on for our burst — advance state and let weapon skills fire + if (STATE._spiritForSkill === 1) { + // First press with spirit on — just let weapon skills fire + STATE._spiritForSkill = 2; + } else if (STATE._spiritForSkill === 2) { + // Skill was already cast — toggle off now + STATE._spiritForSkill = 0; + return { type: 'toggle_spirit', _reason: 'spirit_off_7' }; + } + } else if (!STATE.spiritStance && STATE._spiritForSkill === 0) { + // Toggle on first, mark to toggle off after skill + STATE._spiritForSkill = 1; + return { type: 'toggle_spirit', _reason: 'spirit_on_7' }; + } + } else { + // Reset if conditions no longer met + STATE._spiritForSkill = 0; + } + + // 0e. HIGH-THREAT WEAPON SKILLS — before buffs/items/debuffs // If enemies have high SP bars, kill/stun them NOW before they // use special attacks. Don't waste turns buffing while monsters charge. const SINGLE_THREAT = Math.round(120 * 90 / 100); // 108px = one monster about to special @@ -3890,6 +3915,7 @@ function initializeBattle() { STATE.page = 'battle'; STATE.inBattle = true; STATE._mysticUsed = false; // Reset Mystic Gem tracking on new battle + STATE._spiritForSkill = 0; // Reset spirit burst toggle STATE._baseMpCosts = {}; // Reset base cost cache parseBattleState(); diff --git a/scripts/latest.user.js b/scripts/latest.user.js index 3adc933..08e6566 100644 --- a/scripts/latest.user.js +++ b/scripts/latest.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.14.17 +// @version 0.14.18 // @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.14.17'; +const VERSION = '0.14.18'; const CFG = { // — Battle automation @@ -78,7 +78,8 @@ const STATE = { battleInitialized: false, _mysticUsed: false, // Track if Mystic Gem has been used this battle - _lastActionTime: 0, // Timestamp of last dispatched action (for Q debounce) + _lastActionTime: 0, + _spiritForSkill: 0, // 3-state flag for burst spirit toggle (0=off, 1=toggle-on, 2=cast-done) // Timestamp of last dispatched action (for Q debounce) _baseMpCosts: {}, // Cached base MP costs for buff spells (read from magic pane at battle start) @@ -1427,8 +1428,32 @@ function strategyVeteran() { if (STATE.spiritStance && STATE.sp < 0.60) { return { type: 'toggle_spirit', _reason: 'sp_safety' }; } - - // 0d. HIGH-THREAT WEAPON SKILLS — before buffs/items/debuffs + + // 0d. Spirit Stance for burst clear — toggle on for 7+ mob, off after one skill + // 3-state flag: 0=normal, 1=toggle-on sent, 2=skill-cast done (toggle-off pending) + const is2H = STATE.skillsKnown.includes('Great Cleave') || STATE.skillsKnown.includes('Rending Blow'); + if (is2H && STATE.monsters && STATE.monsters.length >= 7 && STATE.oc >= (CFG.skillOC || 60)) { + if (STATE._spiritForSkill >= 1 && STATE.spiritStance) { + // Spirit is on for our burst — advance state and let weapon skills fire + if (STATE._spiritForSkill === 1) { + // First press with spirit on — just let weapon skills fire + STATE._spiritForSkill = 2; + } else if (STATE._spiritForSkill === 2) { + // Skill was already cast — toggle off now + STATE._spiritForSkill = 0; + return { type: 'toggle_spirit', _reason: 'spirit_off_7' }; + } + } else if (!STATE.spiritStance && STATE._spiritForSkill === 0) { + // Toggle on first, mark to toggle off after skill + STATE._spiritForSkill = 1; + return { type: 'toggle_spirit', _reason: 'spirit_on_7' }; + } + } else { + // Reset if conditions no longer met + STATE._spiritForSkill = 0; + } + + // 0e. HIGH-THREAT WEAPON SKILLS — before buffs/items/debuffs // If enemies have high SP bars, kill/stun them NOW before they // use special attacks. Don't waste turns buffing while monsters charge. const SINGLE_THREAT = Math.round(120 * 90 / 100); // 108px = one monster about to special @@ -3890,6 +3915,7 @@ function initializeBattle() { STATE.page = 'battle'; STATE.inBattle = true; STATE._mysticUsed = false; // Reset Mystic Gem tracking on new battle + STATE._spiritForSkill = 0; // Reset spirit burst toggle STATE._baseMpCosts = {}; // Reset base cost cache parseBattleState(); diff --git a/src/config.js b/src/config.js index a6d590a..6089202 100644 --- a/src/config.js +++ b/src/config.js @@ -2,7 +2,7 @@ // CONFIG — default settings // ═══════════════════════════════════════════════════════════════════════ -const VERSION = '0.14.17'; +const VERSION = '0.14.18'; const CFG = { // — Battle automation diff --git a/src/header.user.js b/src/header.user.js index 6f25459..fd75431 100644 --- a/src/header.user.js +++ b/src/header.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name HV Unified // @namespace hvunified -// @version 0.14.17 +// @version 0.14.18 // @description HV Unified — battle automation, guidance, and UI enhancements for HentaiVerse // @author GaboGG + Hermes // @match *://*.hentaiverse.org/* diff --git a/src/init.js b/src/init.js index 9747870..dba6f6c 100644 --- a/src/init.js +++ b/src/init.js @@ -50,6 +50,7 @@ function initializeBattle() { STATE.page = 'battle'; STATE.inBattle = true; STATE._mysticUsed = false; // Reset Mystic Gem tracking on new battle + STATE._spiritForSkill = 0; // Reset spirit burst toggle STATE._baseMpCosts = {}; // Reset base cost cache parseBattleState(); diff --git a/src/state.js b/src/state.js index 795d7f1..73c7b9a 100644 --- a/src/state.js +++ b/src/state.js @@ -14,7 +14,8 @@ const STATE = { battleInitialized: false, _mysticUsed: false, // Track if Mystic Gem has been used this battle - _lastActionTime: 0, // Timestamp of last dispatched action (for Q debounce) + _lastActionTime: 0, + _spiritForSkill: 0, // 3-state flag for burst spirit toggle (0=off, 1=toggle-on, 2=cast-done) // Timestamp of last dispatched action (for Q debounce) _baseMpCosts: {}, // Cached base MP costs for buff spells (read from magic pane at battle start) diff --git a/src/strategy-engine.js b/src/strategy-engine.js index ca16a97..66af474 100644 --- a/src/strategy-engine.js +++ b/src/strategy-engine.js @@ -702,8 +702,32 @@ function strategyVeteran() { if (STATE.spiritStance && STATE.sp < 0.60) { return { type: 'toggle_spirit', _reason: 'sp_safety' }; } - - // 0d. HIGH-THREAT WEAPON SKILLS — before buffs/items/debuffs + + // 0d. Spirit Stance for burst clear — toggle on for 7+ mob, off after one skill + // 3-state flag: 0=normal, 1=toggle-on sent, 2=skill-cast done (toggle-off pending) + const is2H = STATE.skillsKnown.includes('Great Cleave') || STATE.skillsKnown.includes('Rending Blow'); + if (is2H && STATE.monsters && STATE.monsters.length >= 7 && STATE.oc >= (CFG.skillOC || 60)) { + if (STATE._spiritForSkill >= 1 && STATE.spiritStance) { + // Spirit is on for our burst — advance state and let weapon skills fire + if (STATE._spiritForSkill === 1) { + // First press with spirit on — just let weapon skills fire + STATE._spiritForSkill = 2; + } else if (STATE._spiritForSkill === 2) { + // Skill was already cast — toggle off now + STATE._spiritForSkill = 0; + return { type: 'toggle_spirit', _reason: 'spirit_off_7' }; + } + } else if (!STATE.spiritStance && STATE._spiritForSkill === 0) { + // Toggle on first, mark to toggle off after skill + STATE._spiritForSkill = 1; + return { type: 'toggle_spirit', _reason: 'spirit_on_7' }; + } + } else { + // Reset if conditions no longer met + STATE._spiritForSkill = 0; + } + + // 0e. HIGH-THREAT WEAPON SKILLS — before buffs/items/debuffs // If enemies have high SP bars, kill/stun them NOW before they // use special attacks. Don't waste turns buffing while monsters charge. const SINGLE_THREAT = Math.round(120 * 90 / 100); // 108px = one monster about to special