Battle Cats Auto Display

Auto-show enemy lists

目前為 2025-04-11 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Battle Cats Auto Display
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Auto-show enemy lists
// @author       HmmmE
// @match        https://ponosgames.com/information/appli/battlecats/stage/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function tryRunScript() {
        const ready = typeof setCurrentStageIndex === "function" &&
                      document.querySelector('[id$="enemy_list_1"]');

        if (!ready) return false;

        // 1. Set high stage index
        setCurrentStageIndex(10000);

        // 2. Show all *_enemy_list_1
        document.querySelectorAll('[id$="enemy_list_1"]').forEach(function(el) {
            if (el.id.startsWith("stage") && el.id.includes("_enemy_list_1")) {
                el.style.display = "";
            }
        });

        // 3. Show all *_enemy_list
        document.querySelectorAll('[id$="enemy_list"]').forEach(function(el) {
            if (el.id.startsWith("stage") && el.id.includes("_enemy_list")) {
                el.style.display = "";
            }
        });

        return true;
    }

    // Add a delay (in milliseconds)
    const delayTime = 100; // 0.1 seconds delay (you can adjust this value)

    setTimeout(function() {
        // Keep checking until ready
        const interval = setInterval(() => {
            const success = tryRunScript();
            if (success) clearInterval(interval); // Stop checking when successful
        }, 300); // Check every 300ms
    }, delayTime); // Wait for the specified delay
})();