Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> [Script] Battle anti-suicide, Blocks offensive actions while in critical state to avoid getting surprise oneshotted while clicking

 
post Nov 26 2025, 20:08
Post #1
ultramage



Newcomer
**
Group: Members
Posts: 73
Joined: 12-June 10
Level 317 (Dovahkiin)


Very basic CSS-based helper that makes monsters unclickable while the player is at risk. It is most useful when MonsterBation goes into single-step alert mode which requires manual clicking and where a surprise 20k crit can come at any moment. Also relevant in situations that require a bunch of continuous clicking (such as precisely cycling a skill), too fast to react to a surprise oneshot, and then getting done in with a followup hit. Also relevant if you're using Focus to mass restore MP after each round and thinking you're safe from the last enemy.

I made it into a JS script but you can also just use the css directly if you have a way to input user css.
Attached File  hv_battle_anti_suicide.txt ( 718bytes ) Number of downloads: 0

Update 2025-12-03: The script include pattern was unreliable since HV battles have no set url. Now forced to run on whole site. Also adjusted the selectors to be slighly closer and specifically target the battle UI.

At the moment, it makes monsters and the 'Focus' button unclickable and denies MB hoverplay, if
  • remaining health bar is so tiny that it stops displaying numbers
  • Cloak of the Fallen is active and Spark of Life is not ready
The first is obvious. It also works while dark green to avoid unnecessary SoL procs. It is somewhat limited because css can't do numeric comparisons. The numbers stop appearing at some point below 10% health so it's pretty okay for what it is.
The second is a safeguard after SoL does proc. It's also needed because sometimes SoL procs and leaves the hp gauge wide enough to show numbers, bypassing the first safeguard. It forces you to heal and refill SP. If you cannot, it at least forces you to Defend for a few turns until the buff goes away. Due to how it works, this block cannot be bypassed without disabling the script.
This mechanism can still fail if two monsters decide to unload at the same time, and the second hit is enough to finish off the hp bar even with all the extra damage mitigation from CotF.
CODE
#battle_main:not(:has(#vrhd, #vrhb)) .btm1,
#battle_main:not(:has(#vrhd, #vrhb)) #ckey_focus,
#battle_top:has(#pane_effects img[src$="fallenshield.png"]) ~ #battle_main:not(:has(#vrhd)) .btm1,
#battle_top:has(#pane_effects img[src$="fallenshield.png"]) ~ #battle_main:not(:has(#vrhd)) #ckey_focus {
    pointer-events: none;
}

(#vrhd exists when the hp bar is dark green (protected by SoL) and wide enough to show numbers. #vrhb is the same but bright green (unprotected).)

This post has been edited by ultramage: Dec 3 2025, 14:59
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

 
post Nov 27 2025, 23:27
Post #2
ultramage



Newcomer
**
Group: Members
Posts: 73
Joined: 12-June 10
Level 317 (Dovahkiin)


I was informed that MB hotkeys bypass the css-based blocking. This is true. I researched it and found that css is powerless to prevent js clicks. In fact, I was surprised to learn that my css blocks MB by interfering with the initial 'onmouseover' event that establishes a hover target. Nice coincidence.

To make this work requires patching the MB script. A dirty minimalistic way would be
CODE
@@ -354,1 +354,1 @@
-function TargetMonster(num) { return function() { if ( monsters[num] && monsters[num].hasAttribute('onclick') ) monsters[num].click(); };}
+function TargetMonster(num) { return function() { if ( monsters[num] && monsters[num].hasAttribute('onclick') && getComputedStyle(monsters[num]).pointerEvents !== 'none' ) monsters[num].click(); };}

A while back, before writing the css, I looked into whether MB's hotkey macros could be used to achieve this, by tapping into MB's 'alert' status. Unfortunately, analysis shows that MB is either unfinished or deliberately crippled and only exposes its alert state in HoverAction(), a function that only works when hoverplay is disabled, and that is incompatible with TargetMonster() and so has no way of picking targets. Implementing anti-suicide via mb code or mb hotkeys would require some rework of the script itself.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 9th December 2025 - 17:07